package com.highcom.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
public class UserController {

    // http://localhost/showPage
    @RequestMapping("/showPage")
    public String showPage(){
        System.out.println("user mvc controller is running ... ");
        return "page.jsp";
    }

    //转发  支持访问WEB-INF
    @RequestMapping("/showPage1")
    public String showPage1(){
        System.out.println("user mvc controller is running ... ");
        // 默认都是请求转发，也可以显示的写
        return "forward:/WEB-INF/page.jsp";
    }

    //重定向   不支持访问/WEB-INF 下的页面
    @RequestMapping("/showPage2")
    public String showPage2(){
        System.out.println("user mvc controller is running ... ");
        // redirect
        return "redirect:/WEB-INF/page.jsp";
    }
    // 页面简化访问格式
    //http://localhost/showPage3
    @RequestMapping("/showPage3")
    public String showPage3(){
        System.out.println("user mvc controller is running ... ");
        //配置简化访问后 会自动拼装  ：   /WEB-INF/page/page.jsp
        return "page";
    }

    @RequestMapping("/showPage5")
    public void showPage4(){
        System.out.println("user mvc controller is running  4... ");
   // /WEB-INF/page/showPage5.jsp 最简页面配置方式，使用路径作为页面名称，省略返回值；
    }

}
